package com.xvyy.tingshu.service;

import com.fasterxml.jackson.core.type.TypeReference;

/**
 * ClassName: CacheOpsService
 * Package: com.xvyy.tingshu.search.aspect.service
 *
 * @Description:
 * @Author: xvyy
 * @Create: 2025/2/9 - 14:06
 * @Version: v1.0
 */
public interface CacheOpsService {
    /**
     * 缓存中读数据，不带泛型信息
     * @param cacheKey
     * @param clazz
     * @return T
     * @param <T>
     */
    <T> T getDataFromCache(String cacheKey, Class<T> clazz);

    /**
     * 同步数据到缓存中
     * @param cacheKey
     * @param o
     */
    void saveDataToCache(String cacheKey, Object o);

    /**
     * 从缓存中读取数据，带泛型信息
     * @param cacheKey
     * @param typeReference
     * @return T
     * @param <T>
     */
    <T> T getDataFromCache(String cacheKey, TypeReference<T> typeReference);

}
